
<?php
    @include_once("./conn.php");
    @header("Content-Type:text/json;charset=utf-8");   // 将php的运行结果以 json数据输出到页面

    $search = "select id,goodsId,goodsName,goodsPrice,bigPicList from `goodslist` limit 0,20";

    $result = mysqli_query($conn,$search);

    $all = array();
    while($item = mysqli_fetch_assoc($result)){

        $str = $item["bigPicList"];   //字符串(多个图片以逗号分隔)
        $arr = explode(",",$str);    // 拆分成数组 
        $item["bigPicList"] = $arr[0];   //默认返回第一个

        array_push($all,$item);
    }

    echo json_encode($all);




?>